<?php
require 'Interface.php';
class Simpple_Model_Result_Mysql implements Simpple_Model_Result_Interface {
	private $rs;
	private $row;
	public function __construct($rs) {
		$this->rs = $rs;
	}

	/**
	 * 是否有下条记录
	 *
	 * @return bool
	 */
	function hasNext() {
		return $this->row = mysql_fetch_assoc($this->rs);
	}

	/**
	 * 获取下条记录
	 *
	 * @return mixed
	 */
	function getNext() {
		return $this->row;
	}

	/**
	 * 转化成数组
	 *
	 * @return array
	 */
	function toArray() {
		$ret = array();
		while ($row = mysql_fetch_assoc($this->rs)) {
			$ret[] = $row;
		}
		return $ret;
	}
}
?>